package com.conversationboard.view;

import java.sql.SQLException;
import java.util.List;

import com.conversationboard.model.Board;
import com.conversationboard.model.Boards;
import com.conversationboard.model.User;

public class SelectBoardDisplay {

    /**
     * 
     * Display a list of boards to which the admin can click to move a thread
     * from one board to the next.
     * 
     * @param sourceBoardId
     * @param sourceThreadId
     * @return
     * @throws SQLException
     */

    public static String display(User user) throws SQLException {

        List<Board> boards = Boards.getAuthorisedBoards(user, true);
        StringBuilder buffer = new StringBuilder();

        for (Board board : boards) {
            buffer.append("<input type=RADIO name='targetboardid' value='");
            buffer.append(board.getBoardId());
            buffer.append("'>");
            buffer.append(board.getName());
            buffer.append("</input><br />\n");
        }

        return buffer.toString();
    }

}
